"""file.py
operation function of file system
"""


def write2file(file_path, content, mode="a+"):
    """将字符串写入文件
    args:
        file_path: 文件路径
        content: 写入内容, 字符串类型
        mode: 写入方式, "a"为追加, "w"为覆盖, "a+"为追加(且文件不存在时会自动创建)
    """
    with open(file_path, mode) as f:
        f.write(content)
